package com.cea.papyrustest.uml.createcommand;

import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Profile;

import com.cea.papyrus.core.commands.UMLElementCreateCommand;

/**
 * Test class for {@link Class} creation command
 * @author Remi Schnekenburger
 */
public class ProfileCreateCommandTest extends PapyrusCommandTest{

	/** name of the create element */
	protected static String NAME="Profile0";
	
	/**
	 * Default constructor
	 * @param name the name oif the test case
	 */
	public ProfileCreateCommandTest(String name) {
		super(name);	
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Profile.class,model);
	}

	/* (non-Javadoc)
	 * @see com.cea.papyrustest.PapyrusCommandTest#testExecute()
	 */
	@Override
	public void testExecute() {
		stack.execute(papyrusCommand);
		Element clazz=model.getNestedPackage(NAME);
		assertNotNull("the profile is notcreated",clazz);
		assertTrue("this is not a profile",((clazz)instanceof Profile));
		stack.undo();
		
		assertNull("the profile exist!",model.getNestedPackage(NAME));
		stack.redo();
		clazz=model.getNestedPackage(NAME);
		assertNotNull("the profile is not created",clazz);
		assertTrue("this is not a Profile",((clazz)instanceof Profile));
	}

	
}
